package com.example.xitdemo2.Controller;

import com.example.xitdemo2.User;
import com.example.xitdemo2.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    UserRepository userRepository;

    @GetMapping("/userList")
    public List<User> getUsers(){
        List<User> userList = userRepository.findAll();
        return userList;
    }
}
